#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/init.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("encrypt";)
MODULE_DESCRIPTION("Dummy led");

struct dummy_led {
  struct led_classdev cdev;
};

static void dummy_led_set(struct led_classdev *ldev, enum led_brightness brightness) {
  printk("dummy_led: led");
}


static struct dummy_led led = {
  .cdev = {
    .name = "dummy::led",
    .brightness = LED_OFF,
    .max_brightness = 1,
    .brightness_set = dummy_led_set
  }
};

static int __init dummy_led_init(void) {
  int err;
  printk("dummy_led: Hello from dummy led");
  led.cdev.name = "dummy_led";
  led.cdev.max_brightness = 1;
  led.cdev.brightness_set = dummy_led_set;
  err = led_classdev_register(NULL, &led.cdev);
  if(err < 0)
    return err;
  return 0;
}

static void __exit dummy_led_exit(void) {
  led_classdev_unregister(&led.cdev);
  printk("dummy_led: Cya in another life");
}

module_init(dummy_led_init);
module_exit(dummy_led_exit);
